package com.linuxgt.common.service.restful;

import com.linuxgt.common.service.mybatis.testdb.mapper.AccountDataMapper;
import com.linuxgt.common.service.mybatis.testdb.model.AccountData;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author liuteng
 * @date 17-11-21
 */
@RestController
@RequestMapping("/mysql/*")
public class MysqlController {

    @Autowired
    private AccountDataMapper accountDataMapper;

    @PostMapping("/addAccount")
    public int addAccount(@Param("name") String name, @Param("pwd") String pwd) {
        AccountData accountData = new AccountData();
        accountData.setName(name);
        accountData.setPwd(pwd);
        int resInt = accountDataMapper.insert(accountData);
        return resInt;
    }
}
